import {Button, Col, DatePicker, Form, Input, InputNumber, Row, Select} from "antd";
import React from "react";
import BaseComponent from "../../redare/components/BaseComponent";
import {DownOutlined, UpOutlined} from '@ant-design/icons';


export default class GeneratorSysSearchForm extends BaseComponent {


    formRef = React.createRef();

    constructor(props) {
        super(props);
        this.state = {
            expand: false
        }
    }

    _changeExpand() {
        this.setState({
            expand: !this.state.expand
        });
    }

    setFormData(data) {
        if (this.formRef.current && data) {
            this.formRef.current.setFieldsValue(data);
        }
    }

    onFill = (data) => {
        this.formRef.current.setFieldsValue(data);
    };

    onReset = () => {
        this.formRef.current.resetFields();
        if (this.props.onResetBtnClick) {
            this.props.onResetBtnClick();
        }
    };

    onAdd = () => {
        if (this.props.onAddBtnClick) {
            this.props.onAddBtnClick();
        }
    }


    onFinish = values => {
        if (this.props.onSearchBtnClick) {
            this.props.onSearchBtnClick(values);
        }
    };

    render() {
        return (
            <Form name="advanced_search"
                  className="ant-advanced-search-form"
                  onFinish={this.onFinish}
                  ref={this.formRef}>

                <Row gutter={24}>
                    <Col span={8}>
                        <Form.Item label="关键字" name="key">
                            <Input placeholder="请输入关键字"/>
                        </Form.Item>
                    </Col>
                    <Col span={8} style={{textAlign: 'right'}}>
                        <Button style={{margin: '0 8px'}} onClick={this.onAdd} type="primary">添加</Button>
                        <Button type="primary" htmlType="submit">查询</Button>
                        <Button onClick={this.onReset} style={{margin: '0 8px'}}>重置</Button>
                    </Col>
                </Row>

            </Form>
        )
    }


}







